package study;

public class Parent {
        int age;
        String name;
        String sex;

        public void parent() {
                System.out.println("父类的属性输出");
        }

        @Override
        public String toString() {
                return "Parent [age=" + age + ",name=" + name + ",sex=" + sex + "]";
        }

        @Override
        public boolean equals(Object obj) {
                //为了提高效率
                if (this == obj) {
                        return true;
                }
                if (obj instanceof Parent) {
                        Parent s=(Parent)obj;
                        return this.age==s.age&&this.name.equals(name)&&this.sex.equals(sex);
                }
                return false;
        }
}
